<template>
  <div class="warp-box clearfix">
    <div class="warp-con">
      <div class="header">
        <div class="headerWrapper">
          <div class="search">
            <el-form :inline="true" class="demo-form-inline">
              <el-form-item>
                <el-input placeholder="请输入物种名" v-model="searchForm.speciesName" clearable />
              </el-form-item>
              <el-form-item>
                <el-button type="primary" @click="query">查询</el-button>
              </el-form-item>
              <el-form-item>
                <el-button type="primary" @click="addManageDialog">新增</el-button>
                <!-- <el-button type="primary" class="upload" style="width: 112px" @click="exportPoint" v-if="exportBtn">导出
                 </el-button>-->
              </el-form-item>
            </el-form>
          </div>
        </div>
      </div>
      <div class="content">
        <el-table ref="multipleTable" border stripe :data="tableData" v-loading="loading" element-loading-text="拼命加载中" :max-height="635"
          element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0.8)" style="width:100%" class="tableLine">
          <el-table-column prop="oneName" show-overflow-tooltip label="保存库" align="center" />
          <el-table-column prop="twoName" show-overflow-tooltip label="保存区" align="center" />
          <el-table-column prop="threeName" show-overflow-tooltip label="树种分区" align="center" />
          <el-table-column prop="fourName" show-overflow-tooltip label="小区" align="center" />
          <el-table-column prop="speciesName" show-overflow-tooltip label="物种名" align="center" />
          <el-table-column prop="spTime" show-overflow-tooltip label="整地时间" align="center" />
          <el-table-column prop="spMode" show-overflow-tooltip label="整地方式" align="center" />
          <el-table-column prop="spSpec" show-overflow-tooltip label="整地规格" align="center" />
          <el-table-column fixed="right" label="操作" align="center" width="300">
            <template slot-scope="scope">
              <span class="pointer" @click="prodManageDialog(scope.row)">详情</span>
              <!--<span class="pointer" @click="selectManageDialog(scope.row)"><i class="line"></i>查看</span>-->
              <span class="pointer" @click="updateManageDialog(scope.row)"> <i class="line"></i>修改</span>
              <span class="pointer" @click="deleteManageDialog(scope.row)"> <i class="line"></i>删除</span>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div class="paging">
        <el-pagination :page-size="this.pageSize" :page-sizes="[10,20,50]" :total="tableDataTotalCount"
                       @current-change="handleCurrentChange" @size-change="handleSizeChange" background
                       layout="total, sizes, prev, pager, next, jumper"/>
      </div>
    </div>

    <el-dialog :visible.sync="dialogManageVisible" width="850px" :title="formTitle" :before-close="cancelManage"
      :close-on-click-modal="false">
      <el-form :model="addManageForm" :rules="rules" ref="addManageForm" label-width="140px" label-position="left"
        class="demo-ruleForm">
        <div class="form-table_col4">
          <table border="1" width="100%">
            <tr>
              <td class="form-item_label" style="display: table-cell; vertical-align: middle">
                保存库
              </td>
              <td>
                <el-select filterable v-model="addManageForm.gsName" @change="selectedOne" clearable :disabled="disabled">
                  <el-option v-for="(item, i) in oneData" :label="item.name" :value="item.id" :key="i" />
                </el-select>
              </td>
              <td class="form-item_label">保存区</td>
              <td>
                <el-select filterable v-model="addManageForm.ssName" @change="selectedTwo" clearable :disabled="disabled">
                  <el-option v-for="(item, i) in twoData" :label="item.name" :value="item.id" :key="i" />
                </el-select>
              </td>
            </tr>
            <tr>
              <td class="form-item_label">树种分区
              </td>
              <td>
                <el-select filterable v-model="addManageForm.laArea" @change="selectedThree" clearable :disabled="disabled">
                  <el-option v-for="(item, i) in threeData" :label="item.name" :value="item.id" :key="i" />
                </el-select>
              </td>
              <td class="form-item_label">小区</td>
              <td>
                <el-select filterable v-model="addManageForm.smArea" clearable :disabled="disabled">
                  <el-option v-for="(item, i) in fourData" :label="item.name" :value="item.id" :key="i" />
                </el-select>
              </td>
            </tr>
            <tr>
              <td class="form-item_label">物种名
              </td>
              <td>
                <el-select filterable v-model="addManageForm.speciesName" @change="speciesChange" clearable :disabled="disabled">
                  <el-option v-for="(item, i) in species" :label="item.speciesName" :value="item.speciesName" :key="i" />
                </el-select>
              </td>
              <td>整地时间</td>
              <td>
                <el-date-picker type="datetime" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss" v-model="addManageForm.spTime"
                  :disabled="disabled" />
              </td>
            </tr>
            <tr>
              <td>整地方式
              </td>
              <td>
                <el-input v-model="addManageForm.spMode" />
              </td>
              <td>整地规格</td>
              <td>
                <el-input v-model="addManageForm.spSpec" />
              </td>
            </tr>
            <tr>
              <td>苗木类型
              </td>
              <td>
                <el-input v-model="addManageForm.seedType" />
              </td>
              <td>苗木来源</td>
              <td>
                <el-input v-model="addManageForm.seedSource" />
              </td>
            </tr>
            <tr>
              <td>栽植时间
              </td>
              <td>
                <el-date-picker type="datetime" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss" v-model="addManageForm.plantTime"
                  :disabled="disabled" />
              </td>
              <td>株行距</td>
              <td>
                <el-input v-model="addManageForm.prSpacing" />
              </td>
            </tr>
            <tr>
              <td>造林存活率
              </td>
              <td>
                <el-input v-model="addManageForm.asRate" />
              </td>
              <td>苗高</td>
              <td>
                <el-input v-model="addManageForm.seedHeight" />
              </td>
            </tr>
            <tr>
              <td>地径
              </td>
              <td>
                <el-input v-model="addManageForm.grDiameter" />
              </td>
              <td>根系状况</td>
              <td>
                <el-input v-model="addManageForm.rootCondition" />
              </td>
            </tr>
            <tr>
              <td>健康状况
              </td>
              <td>
                <el-input v-model="addManageForm.healthCondition" />
              </td>
              <td>保存率</td>
              <td>
                <el-input v-model="addManageForm.preRate" />
              </td>
            </tr>
            <tr>
              <td>登记人员</td>
              <td colspan="3"><el-input v-model="addManageForm.registrant" /></td>
            </tr>
            <tr>
              <td style="display:table-cell;vertical-align: middle">备注</td>
              <td colspan="3">
                <el-input type="textarea" v-model="addManageForm.remarks"/>
              </td>
            </tr>
          </table>
        </div>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button v-if="formEdit !== 'read'" class="dialogBtn" type="primary" @click="saveManageData">保 存
        </el-button>
        <el-button type="primary" @click="cancelManage" class="dialogBtn">关 闭
        </el-button>
      </div>
    </el-dialog>

    <el-dialog :visible.sync="dialogProdManageVisible" width="850px" :title="formProdTitle" :before-close="cancelProdManage"
      :close-on-click-modal="false">
      <template>
        <el-tabs v-model="activeName" @tab-click="handleClick">
          <el-tab-pane label="登记详情" name="info">
            <el-form :model="addManageForm" ref="addManageForm" label-width="140px" label-position="left" class="demo-ruleForm">
              <div class="form-table_col4">
                <table border="1" width="100%">
                  <tr>
                    <td class="form-item_label" style="display: table-cell; vertical-align: middle">
                      保存库
                    </td>
                    <td>
                      <el-select filterable v-model="addManageForm.gsName" @change="selectedOne" :disabled="true">
                        <el-option v-for="(item, i) in oneData" :label="item.name" :value="item.id" :key="i" />
                      </el-select>
                    </td>
                    <td class="form-item_label">保存区</td>
                    <td>
                      <el-select filterable v-model="addManageForm.ssName" @change="selectedTwo" clearable :disabled="true">
                        <el-option v-for="(item, i) in twoData" :label="item.name" :value="item.id" :key="i" />
                      </el-select>
                    </td>
                  </tr>
                  <tr>
                    <td class="form-item_label">树种分区
                    </td>
                    <td>
                      <el-select filterable v-model="addManageForm.laArea" @change="selectedThree" clearable :disabled="true">
                        <el-option v-for="(item, i) in threeData" :label="item.name" :value="item.id" :key="i" />
                      </el-select>
                    </td>
                    <td class="form-item_label">小区</td>
                    <td>
                      <el-select filterable v-model="addManageForm.smArea" clearable :disabled="true">
                        <el-option v-for="(item, i) in fourData" :label="item.name" :value="item.id" :key="i" />
                      </el-select>
                    </td>
                  </tr>
                  <tr>
                    <td class="form-item_label">物种名
                    </td>
                    <td>
                      <el-select filterable v-model="addManageForm.speciesName" @change="speciesChange" clearable
                        :disabled="true">
                        <el-option v-for="(item, i) in species" :label="item.speciesName" :value="item.speciesName"
                          :key="i" />
                      </el-select>
                    </td>
                    <td>整地时间</td>
                    <td>
                      <el-date-picker type="datetime" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss" v-model="addManageForm.spTime"
                        :disabled="true" />
                    </td>
                  </tr>
                  <tr>
                    <td>整地方式
                    </td>
                    <td>
                      <el-input v-model="addManageForm.spMode" :disabled="true" />
                    </td>
                    <td>整地规格</td>
                    <td>
                      <el-input v-model="addManageForm.spSpec" :disabled="true" />
                    </td>
                  </tr>
                  <tr>
                    <td>苗木类型
                    </td>
                    <td>
                      <el-input v-model="addManageForm.seedType" :disabled="true" />
                    </td>
                    <td>苗木来源</td>
                    <td>
                      <el-input v-model="addManageForm.seedSource" :disabled="true" />
                    </td>
                  </tr>
                  <tr>
                    <td>栽植时间
                    </td>
                    <td>
                      <el-date-picker type="datetime" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss" v-model="addManageForm.plantTime"
                        :disabled="true" />
                    </td>
                    <td>株行距</td>
                    <td>
                      <el-input v-model="addManageForm.prSpacing" :disabled="true" />
                    </td>
                  </tr>
                  <tr>
                    <td>造林存活率
                    </td>
                    <td>
                      <el-input v-model="addManageForm.asRate" :disabled="true" />
                    </td>
                    <td>苗高</td>
                    <td>
                      <el-input v-model="addManageForm.seedHeight" :disabled="true" />
                    </td>
                  </tr>
                  <tr>
                    <td>地径
                    </td>
                    <td>
                      <el-input v-model="addManageForm.grDiameter" :disabled="true" />
                    </td>
                    <td>根系状况</td>
                    <td>
                      <el-input v-model="addManageForm.rootCondition" :disabled="true" />
                    </td>
                  </tr>
                  <tr>
                    <td>健康状况
                    </td>
                    <td>
                      <el-input v-model="addManageForm.healthCondition" :disabled="true" />
                    </td>
                    <td>保存率</td>
                    <td>
                      <el-input v-model="addManageForm.preRate" :disabled="true" />
                    </td>
                  </tr>
                  <tr>
                    <td>备注
                    </td>
                    <td>
                      <el-input v-model="addManageForm.remarks" :disabled="true" />
                    </td>
                    <td>登记人员</td>
                    <td>
                      <el-input v-model="addManageForm.registrant" :disabled="true" />
                    </td>
                  </tr>
                </table>
              </div>
            </el-form>
          </el-tab-pane>
          <el-tab-pane label="施肥管理" name="first">
            <div class="search">
              <el-form :inline="true" class="demo-form-inline">
                <el-form-item>
                  <el-date-picker v-model="proTime" type="daterange" value-format="yyyy-MM-dd" range-separator="至"
                    start-placeholder="开始日期" end-placeholder="结束日期">
                  </el-date-picker>
                </el-form-item>
                <el-form-item>
                  <el-button type="primary" @click="findPageAfData">查询</el-button>
                </el-form-item>
                <el-form-item>
                  <el-button type="primary" @click="addManageAfDialog">新增</el-button>
                </el-form-item>
              </el-form>
            </div>
            <el-table ref="multipleTable" border stripe :data="tableAfData" style="width: 100%" class="tableLine">
              <el-table-column prop="time" show-overflow-tooltip label="时间" align="center" />
              <el-table-column prop="feType" show-overflow-tooltip label="肥料种类" align="center" />
              <el-table-column prop="consumption" show-overflow-tooltip label="用量 g。株T" align="center" />
              <el-table-column prop="afMethod" show-overflow-tooltip label="施肥方法" align="center" />
              <el-table-column prop="emNumber" show-overflow-tooltip label="用工数" align="center" />
              <el-table-column prop="conWorker" show-overflow-tooltip label="施工员" align="center" />
              <el-table-column fixed="right" label="操作" align="center" width="120">
                <template slot-scope="scope">
                  <span class="pointer" @click="updateManageDialogAf(scope.row)">修改</span>
                  <span class="pointer" @click="deleteManageDialogAf(scope.row)"><i class="line"></i>删除</span>
                </template>
              </el-table-column>
            </el-table>
            <div class="footer">
              <div class="paging info">
                <el-pagination :page-size="this.pageProdAfSize" :page-sizes="[5]" :total="tableDataProdAfTotalCount"
                  @current-change="handleCurrentChangeAf" @size-change="handleSizeChangeAf" background layout="total, sizes, prev, pager, next">
                </el-pagination>
              </div>
            </div>
          </el-tab-pane>
          <el-tab-pane label="绿肥管理" name="second">
            <div class="search">
              <el-form :inline="true" class="demo-form-inline">
                <el-form-item>
                  <el-date-picker v-model="proTime" type="daterange" value-format="yyyy-MM-dd" range-separator="至"
                    start-placeholder="开始日期" end-placeholder="结束日期">
                  </el-date-picker>
                </el-form-item>
                <el-form-item>
                  <el-button type="primary" @click="findPageGmData">查询</el-button>
                </el-form-item>
                <el-form-item>
                  <el-button type="primary" @click="addManageGmDialog">新增</el-button>
                </el-form-item>
              </el-form>
            </div>
            <el-table ref="multipleTable" border stripe :data="tableGmData" style="width: 100%" class="tableLine">
              <el-table-column prop="time" show-overflow-tooltip label="时间" align="center" />
              <el-table-column prop="type" show-overflow-tooltip label="种类" align="center" />
              <el-table-column prop="growth" show-overflow-tooltip label="生长情况" align="center" />
              <el-table-column prop="phTime" show-overflow-tooltip label="翻耕或收获时间" align="center" />
              <el-table-column prop="emNumber" show-overflow-tooltip label="用工数" align="center" />
              <el-table-column prop="conWorker" show-overflow-tooltip label="施工员" align="center" />
              <el-table-column fixed="right" label="操作" align="center" width="120">
                <template slot-scope="scope">
                  <span class="pointer" @click="updateManageDialogGm(scope.row)">修改</span>
                  <span class="pointer" @click="deleteManageDialogGm(scope.row)"><i class="line"></i>删除</span>
                </template>
              </el-table-column>
            </el-table>
            <div class="footer">
              <div class="paging info">
                <el-pagination :page-size="this.pageProdGmSize" :page-sizes="[5]" :total="tableDataProdGmTotalCount"
                  @current-change="handleCurrentChangeGm" @size-change="handleSizeChangeGm" background layout="total, sizes, prev, pager, next">
                </el-pagination>
              </div>
            </div>
          </el-tab-pane>
          <el-tab-pane label="病虫害防治管理" name="third">
            <div class="search">
              <el-form :inline="true" class="demo-form-inline">
                <el-form-item>
                  <el-date-picker v-model="proTime" type="daterange" value-format="yyyy-MM-dd" range-separator="至"
                    start-placeholder="开始日期" end-placeholder="结束日期">
                  </el-date-picker>
                </el-form-item>
                <el-form-item>
                  <el-button type="primary" @click="findPagePcData">查询</el-button>
                </el-form-item>
                <el-form-item>
                  <el-button type="primary" @click="addManagePcDialog">新增</el-button>
                </el-form-item>
              </el-form>
            </div>
            <el-table ref="multipleTable" border stripe :data="tablePcData" style="width: 100%" class="tableLine">
              <el-table-column prop="time" show-overflow-tooltip label="时间" align="center" />
              <el-table-column prop="type" show-overflow-tooltip label="种类" align="center" />
              <el-table-column prop="doHarm" show-overflow-tooltip label="危害程度" align="center" />
              <el-table-column prop="preMeasures" show-overflow-tooltip label="防治措施" align="center" />
              <el-table-column prop="effect" show-overflow-tooltip label="效果" align="center" />
              <el-table-column prop="emNumber" show-overflow-tooltip label="用工数" align="center" />
              <el-table-column prop="conWorker" show-overflow-tooltip label="施工员" align="center" />
              <el-table-column fixed="right" label="操作" align="center" width="120">
                <template slot-scope="scope">
                  <span class="pointer" @click="updateManageDialogPc(scope.row)">修改</span>
                  <span class="pointer" @click="deleteManageDialogPc(scope.row)"><i class="line"></i>删除</span>
                </template>
              </el-table-column>
            </el-table>
            <div class="footer">
              <div class="paging info">
                <el-pagination :page-size="this.pageProdPcSize" :page-sizes="[5]" :total="tableDataProdPcTotalCount"
                  @current-change="handleCurrentChangePc" @size-change="handleSizeChangePc" background layout="total, sizes, prev, pager, next">
                </el-pagination>
              </div>
            </div>
          </el-tab-pane>
          <el-tab-pane label="修剪疏伐管理" name="fourth">
            <div class="search">
              <el-form :inline="true" class="demo-form-inline">
                <el-form-item>
                  <el-date-picker v-model="proTime" type="daterange" value-format="yyyy-MM-dd" range-separator="至"
                    start-placeholder="开始日期" end-placeholder="结束日期">
                  </el-date-picker>
                </el-form-item>
                <el-form-item>
                  <el-button type="primary" @click="findPageThData">查询</el-button>
                </el-form-item>
                <el-form-item>
                  <el-button type="primary" @click="addManageThDialog">新增</el-button>
                </el-form-item>
              </el-form>
            </div>
            <el-table ref="multipleTable" border stripe :data="tableThData" style="width: 100%" class="tableLine">
              <el-table-column prop="time" show-overflow-tooltip label="时间" align="center" />
              <el-table-column prop="method" show-overflow-tooltip label="方法" align="center" />
              <el-table-column prop="emNumber" show-overflow-tooltip label="用工数" align="center" />
              <el-table-column prop="conWorker" show-overflow-tooltip label="施工员" align="center" />
              <el-table-column fixed="right" label="操作" align="center" width="120">
                <template slot-scope="scope">
                  <span class="pointer" @click="updateManageDialogTh(scope.row)">修改</span>
                  <span class="pointer" @click="deleteManageDialogTh(scope.row)"><i class="line"></i>删除</span>
                </template>
              </el-table-column>
            </el-table>
            <div class="footer">
              <div class="paging info">
                <el-pagination :page-size="this.pageProdThSize" :page-sizes="[5]" :total="tableDataProdThTotalCount"
                  @current-change="handleCurrentChangeTh" @size-change="handleSizeChangeTh" background layout="total, sizes, prev, pager, next">
                </el-pagination>
              </div>
            </div>
          </el-tab-pane>
          <el-tab-pane label="幼林抚育管理" name="five">
            <div class="search">
              <el-form :inline="true" class="demo-form-inline">
                <el-form-item>
                  <el-date-picker v-model="proTime" type="daterange" value-format="yyyy-MM-dd" range-separator="至"
                    start-placeholder="开始日期" end-placeholder="结束日期">
                  </el-date-picker>
                </el-form-item>
                <el-form-item>
                  <el-button type="primary" @click="findPageYftData">查询</el-button>
                </el-form-item>
                <el-form-item>
                  <el-button type="primary" @click="addManageYftDialog">新增</el-button>
                </el-form-item>
              </el-form>
            </div>
            <el-table ref="multipleTable" border stripe :data="tableYftData" style="width: 100%" class="tableLine">
              <el-table-column prop="time" show-overflow-tooltip label="时间" align="center" />
              <el-table-column prop="method" show-overflow-tooltip label="方法" align="center" />
              <el-table-column prop="emNumber" show-overflow-tooltip label="用工数" align="center" />
              <el-table-column prop="conWorker" show-overflow-tooltip label="施工员" align="center" />
              <el-table-column fixed="right" label="操作" align="center" width="120">
                <template slot-scope="scope">
                  <span class="pointer" @click="updateManageDialogYft(scope.row)">修改</span>
                  <span class="pointer" @click="deleteManageDialogYft(scope.row)"><i class="line"></i>删除</span>
                </template>
              </el-table-column>
            </el-table>
            <div class="footer">
              <div class="paging info">
                <el-pagination :page-size="this.pageProdYftSize" :page-sizes="[5]" :total="tableDataProdYftTotalCount"
                  @current-change="handleCurrentChangeYft" @size-change="handleSizeChangeYft" background layout="total, sizes, prev, pager, next">
                </el-pagination>
              </div>
            </div>
          </el-tab-pane>
        </el-tabs>
      </template>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="cancelProdManage" class="dialogBtn">关 闭</el-button>
      </div>
    </el-dialog>

    <el-dialog width="850px" :visible.sync="dialogProdAfManageVisible" :title="formProdAfTitle" :before-close="cancelProdAfManage"
      :close-on-click-modal="false">
      <el-form :model="addManageFormAf" ref="addManageFormAf" label-width="50px" label-position="left" class="demo-ruleForm">
        <div class="form-table_col4">
          <table border="1" width="100%">
            <tr>
              <td class="form-item_label">
                时间
              </td>
              <td>
                <el-date-picker type="date" placeholder="选择日期" value-format="yyyy-MM-d" v-model="addManageFormAf.time"
                                :disabled="disabled" />
              </td>
              <td class="form-item_label">
                肥料种类
              </td>
              <td>
                <el-input v-model="addManageFormAf.feType" />
              </td>
            </tr>
            <tr>
              <td class="form-item_label">
                用量
              </td>
              <td>
                <el-input v-model="addManageFormAf.consumption" />
              </td>
              <td class="form-item_label">
                施肥方法
              </td>
              <td>
                <el-input v-model="addManageFormAf.afMethod" />
              </td>
            </tr>
            <tr>
              <td class="form-item_label">
                用工数
              </td>
              <td>
                <el-input v-model="addManageFormAf.emNumber" />
              </td>
              <td class="form-item_label">
                施工员
              </td>
              <td>
                <el-input v-model="addManageFormAf.conWorker" />
              </td>
            </tr>
          </table>
        </div>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button class="dialogBtn" type="primary" @click="saveManageDataAf">保 存</el-button>
        <el-button type="primary" @click="cancelProdAfManage" class="dialogBtn">关 闭</el-button>
      </div>
    </el-dialog>

    <el-dialog width="850px" :visible.sync="dialogProdGmManageVisible" :title="formProdGmTitle" :before-close="cancelProdGmManage"
      :close-on-click-modal="false">
      <el-form :model="addManageFormGm" ref="addManageFormGm" label-width="50px" label-position="left" class="demo-ruleForm">
        <div class="form-table_col4">
          <table border="1" width="100%">
            <tr>
              <td class="form-item_label">
                时间
              </td>
              <td>
                <el-date-picker type="date" placeholder="选择日期" value-format="yyyy-MM-dd" v-model="addManageFormGm.time"
                  :disabled="disabled" />
              </td>
              <td class="form-item_label">
                种类
              </td>
              <td>
                <el-input v-model="addManageFormGm.type" />
              </td>
            </tr>
            <tr>
              <td class="form-item_label">
                生长情况
              </td>
              <td>
                <el-input v-model="addManageFormGm.growth" />
              </td>
              <td class="form-item_label">
                翻耕或收获时间
              </td>
              <td>
                <el-date-picker type="date" placeholder="选择日期" value-format="yyyy-MM-dd" v-model="addManageFormGm.phTime"
                  :disabled="disabled" />
              </td>
            </tr>
            <tr>
              <td class="form-item_label">
                用工数
              </td>
              <td>
                <el-input v-model="addManageFormGm.emNumber" />
              </td>
              <td class="form-item_label">
                施工员
              </td>
              <td>
                <el-input v-model="addManageFormGm.conWorker" />
              </td>
            </tr>
          </table>
        </div>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button class="dialogBtn" type="primary" @click="saveManageDataGm">保 存
        </el-button>
        <el-button type="primary" @click="cancelProdGmManage" class="dialogBtn">关 闭
        </el-button>
      </div>
    </el-dialog>

    <el-dialog width="850px" :visible.sync="dialogProdPcManageVisible" :title="formProdPcTitle" :before-close="cancelProdPcManage"
      :close-on-click-modal="false">
      <el-form :model="addManageFormPc" ref="addManageFormPc" label-width="50px" label-position="left" class="demo-ruleForm">
        <div class="form-table_col4">
          <table border="1" width="100%">
            <tr>
              <td class="form-item_label">
                时间
              </td>
              <td>
                <el-date-picker type="date" placeholder="选择日期" value-format="yyyy-MM-dd" v-model="addManageFormPc.time"
                  :disabled="disabled" />
              </td>
              <td class="form-item_label">
                种类
              </td>
              <td>
                <el-input v-model="addManageFormPc.type" />
              </td>
            </tr>
            <tr>
              <td class="form-item_label">
                危害程度
              </td>
              <td>
                <el-input v-model="addManageFormPc.doHarm" />
              </td>
              <td class="form-item_label">
                防治措施
              </td>
              <td>
                <el-input v-model="addManageFormPc.preMeasures" />
              </td>
            </tr>
            <tr>
              <td class="form-item_label">
                效果
              </td>
              <td>
                <el-input v-model="addManageFormPc.effect" />
              </td>
              <td class="form-item_label">
                用工数
              </td>
              <td>
                <el-input v-model="addManageFormPc.emNumber" />
              </td>
            </tr>
            <tr>
              <td class="form-item_label">
                施工员
              </td>
              <td>
                <el-input v-model="addManageFormPc.conWorker" />
              </td>
            </tr>
          </table>
        </div>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button class="dialogBtn" type="primary" @click="saveManageDataPc">保 存
        </el-button>
        <el-button type="primary" @click="cancelProdPcManage" class="dialogBtn">关 闭
        </el-button>
      </div>
    </el-dialog>

    <el-dialog width="850px" :visible.sync="dialogProdThManageVisible" :title="formProdThTitle" :before-close="cancelProdThManage"
      :close-on-click-modal="false">
      <el-form :model="addManageFormTh" ref="addManageFormTh" label-width="50px" label-position="left" class="demo-ruleForm">
        <div class="form-table_col4">
          <table border="1" width="100%">
            <tr>
              <td class="form-item_label">
                时间
              </td>
              <td>
                <el-date-picker type="date" placeholder="选择日期" value-format="yyyy-MM-dd" v-model="addManageFormTh.time"
                  :disabled="disabled" />
              </td>
              <td class="form-item_label">
                方法
              </td>
              <td>
                <el-input v-model="addManageFormTh.method" />
              </td>
            </tr>
            <tr>
              <td class="form-item_label">
                用工数
              </td>
              <td>
                <el-input v-model="addManageFormTh.emNumber" />
              </td>
              <td class="form-item_label">
                施工员
              </td>
              <td>
                <el-input v-model="addManageFormTh.conWorker" />
              </td>
            </tr>
          </table>
        </div>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button class="dialogBtn" type="primary" @click="saveManageDataTh">保 存
        </el-button>
        <el-button type="primary" @click="cancelProdThManage" class="dialogBtn">关 闭
        </el-button>
      </div>
    </el-dialog>

    <el-dialog width="850px" :visible.sync="dialogProdYftManageVisible" :title="formProdYftTitle" :before-close="cancelProdYftManage"
      :close-on-click-modal="false">
      <el-form :model="addManageFormYft" ref="addManageFormYft" label-width="50px" label-position="left" class="demo-ruleForm">
        <div class="form-table_col4">
          <table border="1" width="100%">
            <tr>
              <td class="form-item_label">
                时间
              </td>
              <td>
                <el-date-picker type="date" placeholder="选择日期" value-format="yyyy-MM-dd" v-model="addManageFormYft.time"
                  :disabled="disabled" />
              </td>
              <td class="form-item_label">
                方法
              </td>
              <td>
                <el-input v-model="addManageFormYft.method" />
              </td>
            </tr>
            <tr>
              <td class="form-item_label">
                用工数
              </td>
              <td>
                <el-input v-model="addManageFormYft.emNumber" />
              </td>
              <td class="form-item_label">
                施工员
              </td>
              <td>
                <el-input v-model="addManageFormYft.conWorker" />
              </td>
            </tr>
          </table>
        </div>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button class="dialogBtn" type="primary" @click="saveManageDataYft">保 存
        </el-button>
        <el-button type="primary" @click="cancelProdYftManage" class="dialogBtn">关 闭
        </el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
  import prodManageApi from '@/api/ProdManageApi'
  import resourceApi from '@/api/resourceApi'
  import ResourceManageApi from "../../../../api/ResourceManageApi";

  export default {
    name: "prodManage",
    data() {
      return {
        loading: false,
        upHeader: {
          token: `${window.localStorage.token}`
        },
        searchForm: {
          speciesName: null
        },
        pageIndex: 1,
        pageSize: 10,
        totalCount: 0,
        tableData: [],
        formTitle: null,
        dialogManageVisible: false,
        addManageForm: {},
        rules: {
          gsName: [{
            required: true,
            message: '保存库不能为空',
            trigger: 'blur'
          }],
          ssName: [{
            required: true,
            message: '保存区不能为空',
            trigger: 'blur'
          }],
          laArea: [{
            required: true,
            message: '树种分区不能为空',
            trigger: 'blur'
          }],
          smArea: [{
            required: true,
            message: '小区不能为空',
            trigger: 'blur'
          }],
          speciesName: [{
            required: true,
            message: '物种名不能为空',
            trigger: 'blur'
          }]
        },
        formEdit: null,
        speciesMap: {},
        disabled: false,
        species: [],
        oneData: [],
        twoData: [],
        threeData: [],
        fourData: [],
        dialogProdManageVisible: false,
        formProdTitle: '登记详情',
        activeName: 'info',
        tableAfData: [],
        tablePcData: [],
        tableThData: [],
        tableGmData: [],
        tableYftData: [],
        prodId: '',
        pageProdAfIndex: 1,
        pageProdAfSize: 5,
        totalAfCount: 0,
        pageProdGmIndex: 1,
        pageProdGmSize: 5,
        totalGmCount: 0,
        pageProdPcIndex: 1,
        pageProdPcSize: 5,
        totalPcCount: 0,
        pageProdThIndex: 1,
        pageProdThSize: 5,
        totalThCount: 0,
        pageProdYftIndex: 1,
        pageProdYftSize: 5,
        totalYftCount: 0,
        dialogProdAfManageVisible: false,
        formProdAfTitle: null,
        addManageFormAf: {
          registerId: ''
        },
        dialogProdGmManageVisible: false,
        formProdGmTitle: null,
        addManageFormGm: {
          registerId: ''
        },
        dialogProdPcManageVisible: false,
        formProdPcTitle: null,
        addManageFormPc: {
          registerId: ''
        },
        dialogProdThManageVisible: false,
        formProdThTitle: null,
        addManageFormTh: {
          registerId: ''
        },
        dialogProdYftManageVisible: false,
        formProdYftTitle: null,
        addManageFormYft: {
          registerId: ''
        },
        searchFormAf: {
          startTime: null,
          endTime: null
        },
        proTime: null
      }
    },
    computed: {
      tableDataTotalCount() {
        return this.totalCount ? this.totalCount : 0
      },
      tableDataProdAfTotalCount() {
        return this.totalAfCount ? this.totalAfCount : 0
      },
      tableDataProdGmTotalCount() {
        return this.totalGmCount ? this.totalGmCount : 0
      },
      tableDataProdPcTotalCount() {
        return this.totalPcCount ? this.totalPcCount : 0
      },
      tableDataProdThTotalCount() {
        return this.totalThCount ? this.totalThCount : 0
      },
      tableDataProdYftTotalCount() {
        return this.totalYftCount ? this.totalYftCount : 0
      },
    },
    created() {
      this.findPageData()
    },
    methods: {
      query() {
        this.pageIndex = 1;
        this.findPageData();
      },
      //生产管理分页
      findPageData() {
        let params = {
          speciesName: this.searchForm.speciesName,
          pageIndex: this.pageIndex,
          pageSize: this.pageSize
        }
        this.loading = true
        prodManageApi.findPmPage(params).then(res => {
          this.loading = false
          if (res.data.message === 'success') {
            this.tableData = res.data.result.rows
            this.totalCount = res.data.result.totalCount
          } else {
            this.tableData = []
            this.totalCount = 0
          }
        })
      },
      pager(val) {
        this.pageIndex = val
      },
      handleSizeChange(val) {
        this.pageSize = val
        this.tableData = []
        this.findPageData()
      },
      handleCurrentChange(val) {
        this.pageIndex = val
        this.tableData = []
        this.findPageData()
      },
      //新增生产管理弹窗
      addManageDialog() {
        this.formTitle = '新增-生产管理'
        this.formEdit = 'add'
        this.getSpecies()
        this.getOne()
        this.dialogManageVisible = true
      },
      //修改生产管理弹窗
      updateManageDialog(row) {
        this.formEdit = 'edit'
        this.formTitle = '修改-生产管理'
        this.getInfo(row)
        this.dialogManageVisible = true
      },
      selectManageDialog(row) {
        this.getInfo(row)
        this.formEdit = 'read'
        this.formTitle = '详情-生产管理'
        this.dialogManageVisible = true
      },
      //删除生产管理弹窗
      deleteManageDialog(row) {
        let tips = ''
        if (row) {
          tips = `此操作将删除: ${row.speciesName}, 是否继续?`
        } else {
          return
        }
        this.$confirm(tips, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          prodManageApi.deleteProdManage(row.id).then((res) => {
            if (res.data.messageCode === '200') {
              this.$notify({
                title: '消息',
                message: ('删除成功！'),
                position: 'bottom-right',
                showClose: false,
                type: 'success'
              })
              this.findPageData()
            }
          })
        }).catch((error) => {
          console.log(error)
        })
      },
      //取消生产管理
      cancelManage() {
        this.dialogManageVisible = false
        this.addManageForm = {}
      },
      //标签页详情
      getTabInfo(row) {
        this.getOne()
        let oneId = row.gsName
        if (oneId) {
          this.getChildren(oneId).then(res => {
            this.twoData = res
          })
        }
        let twoId = row.ssName
        if (twoId) {
          this.getChildren(twoId).then(res => {
            this.threeData = res
          })
        }
        let threeId = row.laArea
        if (threeId) {
          this.getChildren(threeId).then(res => {
            this.fourData = res
          })
        }
        this.getSpecies()
        prodManageApi.getInfoProdManage(row.id).then(res => {
          if (res.data.messageCode === '200') {
            this.addManageForm = res.data.result
          }
        })
      },
      //回显生产管理数据
      async getInfo(row) {
        this.getOne()
        let oneId = row.gsName
        if (oneId) {
          this.getChildren(oneId).then(res => {
            this.twoData = res
          })
        }
        let twoId = row.ssName
        if (twoId) {
          this.getChildren(twoId).then(res => {
            this.threeData = res
          })
        }
        let threeId = row.laArea
        if (threeId) {
          this.getChildren(threeId).then(res => {
            this.fourData = res
          })
        }
        this.getSpecies()
        const res = await prodManageApi.getInfoProdManage(row.id)
        if (res.data.messageCode === '200') {
          let result = res.data.result
          this.addManageForm = result
          this.dialogManageVisible = true
        }
      },
      //查询物种名称
      getSpecies() {
        this.species = []
        this.speciesMap = {}
        resourceApi.findSpecies().then((res) => {
          let result = res.data.result
          if (res.data.message === 'success' && result) {
            this.species = result
            for (let i in result) {
              let item = result[i]
              this.$set(this.speciesMap, item.speciesName, item)
            }
          }
        })
      },
      //物种名称下拉框
      speciesChange(value) {
        let name
        if (value) {
          let data = this.speciesMap[value]
          name = data.speciesName
        }
        this.addManageForm.speciesName = name
      },
      getOne() {
        this.getModule('one').then(res => {
          this.oneData = res
        })
      },
      async getModule(module) {
        let result = []
        let res = await ResourceManageApi.getModule(module)
        if (res.data.message === 'success') {
          result = res.data.result
        }
        return result
      },
      //获取联级查询下拉框
      async getChildren(data) {
        let result = []
        if (data) {
          let res = await ResourceManageApi.getChildren(data)
          if (res.data.message === 'success') {
            result = res.data.result;
          }
        }
        return result
      },
      //保存库名称下拉框
      selectedOne(data) {
        this.twoData = []
        this.threeData = []
        this.fourData = []
        this.$set(this.addManageForm, 'ssName', null)
        this.$set(this.addManageForm, 'laArea', null)
        this.$set(this.addManageForm, 'smArea', null)
        if (data) {
          this.getChildren(data).then(res => {
            this.twoData = res
          })
        }
      },
      //物种保存库名称下拉框
      selectedTwo(data) {
        this.threeData = []
        this.fourData = []
        this.$set(this.addManageForm, 'laArea', null)
        this.$set(this.addManageForm, 'smArea', null)
        if (data) {
          this.getChildren(data).then(res => {
            this.threeData = res
          })
        }
      },
      //大区下拉框
      selectedThree(data) {
        this.fourData = []
        this.$set(this.addManageForm, 'smArea', null)
        if (data) {
          this.getChildren(data).then(res => {
            this.fourData = res
          })
        }
      },
      //加载
      showLoading() {
        this.$loading({
          lock: true,
          text: 'Loading',
          spinner: 'el-icon-loading',
          background: 'rgba(0, 0, 0, 0.7)'
        })
      },
      //关闭加载
      hideLoading() {
        this.$loading().close()
      },
      //生产管理非空验证
      validation() {
        let flag = true
        let message = null
        if (!this.addManageForm.gsName) {
          flag = false
          message = '保存库不能为空'
        }
        if (flag && !this.addManageForm.ssName) {
          flag = false
          message = '保存区不能为空'
        }
        if (flag && !this.addManageForm.laArea) {
          flag = false
          message = '树种分区不能为空'
        }
        if (flag && !this.addManageForm.smArea) {
          flag = false
          message = '小区不能为空'
        }
        if (flag && !this.addManageForm.speciesName) {
          flag = false
          message = '物种名不能为空'
        }
        if (!flag) {
          this.$message({
            message: message,
            type: 'warning'
          })
          return false
        }
        return true
      },
      //保存生产管理
      saveManageData() {
        if (this.validation()) {
          this.showLoading()
          let params = Object.assign({}, this.addManageForm)
          prodManageApi.saveProdManage(params).then(res => {
            this.hideLoading()
            let message = this.formEdit === 'edit' ? '修改' : '保存'
            if (res.data.message === 'success') {
              this.$notify({
                title: '消息',
                message: (message + '成功！'),
                position: 'bottom-right',
                showClose: false,
                type: 'success'
              })
              this.cancelManage()
              this.findPageData()
            } else {
              this.$notify.error({
                title: '消息',
                message: message + '失败'
              })
            }
          })
        }
      },
      prodManageDialog(row) {
        this.prodId = row.id
        this.getTabInfo(row)
        this.dialogProdManageVisible = true
      },
      cancelProdManage() {
        this.dialogProdManageVisible = false
        this.addManageForm = {}
      },

      //标签分页点击事件
      handleClick(tab, event) {
        this.proTime = null;
        if (tab.name === 'first') {
          this.pageProdAfIndex = 1;
          this.findPageAfData()
        }
        if (tab.name === 'second') {
          this.pageProdGmIndex = 1;
          this.findPageGmData()
        }
        if (tab.name === 'third') {
          this.pageProdPcIndex = 1;
          this.findPagePcData()
        }
        if (tab.name === 'fourth') {
          this.pageProdThIndex = 1;
          this.findPageThData()
        }
        if (tab.name === 'five') {
          this.pageProdYftIndex = 1;
          this.findPageYftData();
        }
        if (tab.name === 'info') {

        }
      },

      //施肥
      handleSizeChangeAf(val) {
        this.pageProdAfSize = val
        this.tableAfData = []
        this.findPageAfData()
      },
      handleCurrentChangeAf(val) {
        this.pageProdAfIndex = val
        this.tableAfData = []
        this.findPageAfData()
      },
      findPageAfData() {
        if (this.proTime != null) {
          this.searchFormAf.startTime = this.proTime[0]
          this.searchFormAf.endTime = this.proTime[1]
        }
        let params = {
          startTime: this.searchFormAf.startTime,
          endTime: this.searchFormAf.endTime,
          registerId: this.prodId,
          pageIndex: this.pageProdAfIndex,
          pageSize: this.pageProdAfSize
        }
        prodManageApi.findAfPage(params).then(res => {
          if (res.data.message === 'success') {
            this.tableAfData = res.data.result.rows
            this.totalAfCount = res.data.result.totalCount
          } else {
            this.tableAfData = []
            this.totalAfCount = 0
          }
        })
      },
      addManageAfDialog() {
        this.formProdAfTitle = '新增施肥'
        this.dialogProdAfManageVisible = true
      },
      updateManageDialogAf(row) {
        this.formProdAfTitle = '修改施肥'
        this.addManageFormAf = Object.assign({}, row)
        this.dialogProdAfManageVisible = true
      },
      deleteManageDialogAf(row) {
        let tips = ''
        if (row) {
          tips = `此操作将删除该条记录, 是否继续?`
        } else {
          return
        }
        this.$confirm(tips, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          prodManageApi.deleteProdAfManage(row.id).then((res) => {
            if (res.data.messageCode === '200') {
              this.$notify({
                title: '消息',
                message: ('删除成功！'),
                position: 'bottom-right',
                showClose: false,
                type: 'success'
              })
              this.findPageAfData()
            }
          })
        }).catch((error) => {
          console.log(error)
        })
      },
      cancelProdAfManage() {
        this.dialogProdAfManageVisible = false
        this.addManageFormAf = {}
      },
      saveManageDataAf() {
        this.addManageFormAf.registerId = this.prodId;
        let params = Object.assign({}, this.addManageFormAf);
        if (this.validateForm('first', params)) {
          prodManageApi.saveProdAfManage(params).then(res => {
            if (res.data.messageCode === '200') {
              this.$notify({
                title: '消息',
                message: ('保存成功！'),
                position: 'bottom-right',
                showClose: false,
                type: 'success'
              })
              this.cancelProdAfManage()
              this.findPageAfData()
            } else {
              this.$notify.error({
                title: '消息',
                message: '保存失败'
              })
            }
          })
        }
      },

      //绿肥
      handleSizeChangeGm(val) {
        this.pageProdGmSize = val
        this.tableGmData = []
        this.findPageGmData()
      },
      handleCurrentChangeGm(val) {
        this.pageProdGmIndex = val;
        this.tableGmData = [];
        this.findPageGmData();
      },
      findPageGmData() {
        if (this.proTime != null) {
          this.searchFormAf.startTime = this.proTime[0]
          this.searchFormAf.endTime = this.proTime[1]
        }
        let params = {
          startTime: this.searchFormAf.startTime,
          endTime: this.searchFormAf.endTime,
          registerId: this.prodId,
          pageIndex: this.pageProdGmIndex,
          pageSize: this.pageProdGmSize
        }
        prodManageApi.findGmPage(params).then(res => {
          if (res.data.message === 'success') {
            this.tableGmData = res.data.result.rows
            this.totalGmCount = res.data.result.totalCount
          } else {
            this.tableGmData = []
            this.totalGmCount = 0
          }
        })
      },
      addManageGmDialog() {
        this.formProdGmTitle = '新增绿肥'
        this.dialogProdGmManageVisible = true
      },
      updateManageDialogGm(row) {
        this.formProdGmTitle = '修改绿肥'
        this.addManageFormGm = Object.assign({}, row)
        this.dialogProdGmManageVisible = true
      },
      deleteManageDialogGm(row) {
        let tips = ''
        if (row) {
          tips = `此操作将删除该条记录, 是否继续?`
        } else {
          return
        }
        this.$confirm(tips, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          prodManageApi.deleteProdGmManage(row.id).then((res) => {
            if (res.data.messageCode === '200') {
              this.$notify({
                title: '消息',
                message: ('删除成功！'),
                position: 'bottom-right',
                showClose: false,
                type: 'success'
              })
              this.findPageGmData()
            }
          })
        }).catch((error) => {
          console.log(error)
        })
      },
      cancelProdGmManage() {
        this.dialogProdGmManageVisible = false
        this.addManageFormGm = {}
      },
      validateForm(form, params) {
        let flag = true;
        let message = null;
        if (!params.time) {
          flag = false;
          message = "时间不能为空";
        }

        if (form === 'second' || form === 'third') {
          if (flag && !params.type) {
            flag = false;
            message = "种类不能为空";
          }
        }

        if (form === 'first') {
          if (flag && !params.feType) {
            flag = false;
            message = "肥料种类不能为空";
          }

          if (flag && !params.consumption) {
            flag = false;
            message = "用量不能为空";
          }

          if (flag && !params.afMethod) {
            flag = false;
            message = "施肥方法不能为空";
          }
        } else if (form === 'second') {
          if (flag && !params.growth) {
            flag = false;
            message = "生长情况不能为空";
          }

          if (flag && !params.phTime) {
            flag = false;
            message = "翻耕或收获时间不能为空";
          }
        } else if (form === 'third') {
          if (flag && !params.doHarm) {
            flag = false;
            message = "危害程度不能为空";
          }

          if (flag && !params.preMeasures) {
            flag = false;
            message = "防治措施不能为空";
          }

          if (flag && !params.effect) {
            flag = false;
            message = "效果不能为空";
          }
        }

        if (form === 'fourth' || form === 'five') {
          if (flag && !params.method) {
            flag = false;
            message = "方法不能为空";
          }
        }

        if (flag && !params.emNumber) {
          flag = false;
          message = "用工数不能为空";
        }

        if (flag && !params.conWorker) {
          flag = false;
          message = "施工员不能为空";
        }

        if (!flag) {
          this.$message({
            message: message,
            type: 'warning'
          })
        }
        return flag;
      },
      saveManageDataGm() {
        this.addManageFormGm.registerId = this.prodId;
        let params = Object.assign({}, this.addManageFormGm);
        if (this.validateForm('second', params)) {
          prodManageApi.saveProdGmManage(params).then(res => {
            if (res.data.messageCode === '200') {
              this.$notify({
                title: '消息',
                message: ('保存成功！'),
                position: 'bottom-right',
                showClose: false,
                type: 'success'
              })
              this.cancelProdGmManage()
              this.findPageGmData()
            } else {
              this.$notify.error({
                title: '消息',
                message: '保存失败'
              })
            }
          })
        }
      },

      //病虫害防治
      handleSizeChangePc(val) {
        this.pageProdPcSize = val
        this.tablePcData = []
        this.findPagePcData()
      },
      handleCurrentChangePc(val) {
        this.pageProdPcIndex = val;
        this.tablePcData = [];
        this.findPagePcData();
      },
      findPagePcData() {
        if (this.proTime != null) {
          this.searchFormAf.startTime = this.proTime[0]
          this.searchFormAf.endTime = this.proTime[1]
        }
        let params = {
          startTime: this.searchFormAf.startTime,
          endTime: this.searchFormAf.endTime,
          registerId: this.prodId,
          pageIndex: this.pageProdPcIndex,
          pageSize: this.pageProdPcSize
        }
        prodManageApi.findPcPage(params).then(res => {
          if (res.data.message === 'success') {
            this.tablePcData = res.data.result.rows
            this.totalPcCount = res.data.result.totalCount
          } else {
            this.tablePcData = []
            this.totalPcCount = 0
          }
        })
      },
      addManagePcDialog() {
        this.formProdPcTitle = '新增病虫害防治'
        this.dialogProdPcManageVisible = true
      },
      updateManageDialogPc(row) {
        this.formProdPcTitle = '修改病虫害防治记录'
        this.addManageFormPc = Object.assign({}, row)
        this.dialogProdPcManageVisible = true
      },
      deleteManageDialogPc(row) {
        let tips = ''
        if (row) {
          tips = `此操作将删除该条记录, 是否继续?`
        } else {
          return
        }
        this.$confirm(tips, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          prodManageApi.deleteProdPcManage(row.id).then((res) => {
            if (res.data.messageCode === '200') {
              this.$notify({
                title: '消息',
                message: ('删除成功！'),
                position: 'bottom-right',
                showClose: false,
                type: 'success'
              })
              this.findPagePcData()
            }
          })
        }).catch((error) => {
          console.log(error)
        })
      },
      cancelProdPcManage() {
        this.dialogProdPcManageVisible = false
        this.addManageFormPc = {}
      },
      saveManageDataPc() {
        this.addManageFormPc.registerId = this.prodId
        let params = Object.assign({}, this.addManageFormPc)
        if (this.validateForm('third', params)) {
          prodManageApi.saveProdPcManage(params).then(res => {
            if (res.data.messageCode === '200') {
              this.$notify({
                title: '消息',
                message: ('保存成功！'),
                position: 'bottom-right',
                showClose: false,
                type: 'success'
              })
              this.cancelProdPcManage()
              this.findPagePcData()
            } else {
              this.$notify.error({
                title: '消息',
                message: '保存失败'
              })
            }
          })
        }
      },

      //修剪疏伐
      handleSizeChangeTh(val) {
        this.pageProdThSize = val
        this.tableThData = []
        this.findPageThData()
      },
      handleCurrentChangeTh(val) {
        this.pageProdThIndex = val
        this.tableThData = []
        this.findPageThData()
      },
      findPageThData() {
        if (this.proTime != null) {
          this.searchFormAf.startTime = this.proTime[0]
          this.searchFormAf.endTime = this.proTime[1]
        }
        let params = {
          startTime: this.searchFormAf.startTime,
          endTime: this.searchFormAf.endTime,
          registerId: this.prodId,
          pageIndex: this.pageProdThIndex,
          pageSize: this.pageProdThSize
        }
        prodManageApi.findThPage(params).then(res => {
          if (res.data.message === 'success') {
            this.tableThData = res.data.result.rows
            this.totalThCount = res.data.result.totalCount
          } else {
            this.tableThData = []
            this.totalThCount = 0
          }
        })
      },
      addManageThDialog() {
        this.formProdThTitle = '新增修剪疏伐'
        this.dialogProdThManageVisible = true
      },
      updateManageDialogTh(row) {
        this.formProdThTitle = '修改修剪疏伐'
        this.addManageFormTh = Object.assign({}, row)
        this.dialogProdThManageVisible = true
      },
      deleteManageDialogTh(row) {
        let tips = ''
        if (row) {
          tips = `此操作将删除该条记录, 是否继续?`
        } else {
          return
        }
        this.$confirm(tips, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          prodManageApi.deleteProdThManage(row.id).then((res) => {
            if (res.data.messageCode === '200') {
              this.$notify({
                title: '消息',
                message: ('删除成功！'),
                position: 'bottom-right',
                showClose: false,
                type: 'success'
              })
              this.findPageThData()
            }
          })
        }).catch((error) => {
          console.log(error)
        })
      },
      cancelProdThManage() {
        this.dialogProdThManageVisible = false
        this.addManageFormTh = {}
      },
      saveManageDataTh() {
        this.addManageFormTh.registerId = this.prodId
        let params = Object.assign({}, this.addManageFormTh)
        if (this.validateForm('fourth', params)) {
          prodManageApi.saveProdThManage(params).then(res => {
            if (res.data.messageCode === '200') {
              this.$notify({
                title: '消息',
                message: ('保存成功！'),
                position: 'bottom-right',
                showClose: false,
                type: 'success'
              })
              this.cancelProdThManage()
              this.findPageThData()
            } else {
              this.$notify.error({
                title: '消息',
                message: '保存失败'
              })
            }
          })
        }
      },

      //幼林抚育
      handleSizeChangeYft(val) {
        this.pageProdYftSize = val
        this.tableYftData = []
        this.findPageYftData()
      },
      handleCurrentChangeYft(val) {
        this.pageProdYftIndex = val
        this.tableYftData = []
        this.findPageYftData()
      },
      findPageYftData() {
        if (this.proTime != null) {
          this.searchFormAf.startTime = this.proTime[0]
          this.searchFormAf.endTime = this.proTime[1]
        }
        let params = {
          startTime: this.searchFormAf.startTime,
          endTime: this.searchFormAf.endTime,
          registerId: this.prodId,
          pageIndex: this.pageProdYftIndex,
          pageSize: this.pageProdYftSize
        }
        prodManageApi.findYftPage(params).then(res => {
          if (res.data.message === 'success') {
            this.tableYftData = res.data.result.rows
            this.totalYftCount = res.data.result.totalCount
          } else {
            this.tableYftData = []
            this.totalYftCount = 0
          }
        })
      },
      addManageYftDialog() {
        this.formProdYftTitle = '新增幼林抚育'
        this.dialogProdYftManageVisible = true
      },
      updateManageDialogYft(row) {
        this.formProdYftTitle = '修改幼林抚育'
        this.addManageFormYft = Object.assign({}, row)
        this.dialogProdYftManageVisible = true
      },
      deleteManageDialogYft(row) {
        let tips = ''
        if (row) {
          tips = `此操作将删除该条记录, 是否继续?`
        } else {
          return
        }
        this.$confirm(tips, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          prodManageApi.deleteProdYftManage(row.id).then((res) => {
            if (res.data.messageCode === '200') {
              this.$notify({
                title: '消息',
                message: ('删除成功！'),
                position: 'bottom-right',
                showClose: false,
                type: 'success'
              })
              this.findPageYftData()
            }
          })
        }).catch((error) => {
          console.log(error)
        })
      },
      cancelProdYftManage() {
        this.dialogProdYftManageVisible = false
        this.addManageFormYft = {}
      },
      saveManageDataYft() {
        this.addManageFormYft.registerId = this.prodId
        let params = Object.assign({}, this.addManageFormYft)
        if (this.validateForm('five', params)) {
          prodManageApi.saveProdYftManage(params).then(res => {
            if (res.data.messageCode === '200') {
              this.$notify({
                title: '消息',
                message: ('保存成功！'),
                position: 'bottom-right',
                showClose: false,
                type: 'success'
              })
              this.cancelProdYftManage()
              this.findPageYftData()
            } else {
              this.$notify.error({
                title: '消息',
                message: '保存失败'
              })
            }
          })
        }
      },
    }
  }
</script>

<style lang="less" scoped>
  .search {
    & /deep/ .el-form-item__label {
      font-size: 1.8rem;
    }
  }

  .form-table {
    width: 100%;

    table,
    tr,
    td {
      border: 1px solid #fff;
    }

    td {
      &:nth-child(even) {
        width: 32%;
      }

      &:nth-child(odd) {
        text-indent: 10px;
      }
    }

    /deep/ .el-input__inner {
      border: none;
    }
  }

  .el-form-item__label {
    padding: 0 20px 0 0 !important;
  }

  .content {
    margin-top: 10px;

    & /deep/ .el-checkbox__inner {
      height: 20px;
      width: 20px;
      font-size: 28px;
      font-weight: 400;
      color: rgba(255, 255, 255, 1);
      background: none;
    }

    & /deep/ .el-tooltip__popper {
      background-color: red;
    }

    & /deep/ .el-checkbox__inner::after {
      border-width: 2px;
      /* border-color: black; */
      height: 6px;
      left: 6px;
      top: 3px;
      width: 4px;
    }

    & /deep/ .el-checkbox__input.is-indeterminate .el-checkbox__inner::before {
      top: 8px;
      background: white;
    }
  }

  .line {
    display: inline-flex;
    height: 21px;
    width: 1px;
    background: rgba(0, 255, 255, 1);
    margin: 0 10px;
    vertical-align: middle;
  }

  .dialogBtn {
    font-size: 1.6rem;

    &:hover {
      background: rgba(12, 161, 151, 1);
    }
  }

  .coordinate {
    width: 25%;
  }
</style>
<style lang="less">
  /**
     * 修改样式   覆盖默认的饿了么全局样式
     */
  .el-form-item__label {
    padding: 0 20px 0 0 !important;
  }
</style>
